package com.ssh.action.sina.weibo;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import weibo4j_2.util.WeiboConfig;

import com.ssh.action.BaseAction;

public class RequestTokenAction extends BaseAction{

	private String result;
	
	/**
	 * @return the result
	 */
	public String getResult() {
		return result;
	}

	/**
	 * @param result the result to set
	 */
	public void setResult(String result) {
		this.result = result;
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 2759479304332110637L;
	
	@Override
	public String execute() throws Exception {
		
		HttpServletResponse response = ServletActionContext.getResponse();
		String clientID= WeiboConfig.getValue("client_ID");
		String redirect_uri= WeiboConfig.getValue("redirect_URI");
		String url = "https://api.weibo.com/oauth2/authorize?client_id=" + clientID + "&response_type=code&redirect_uri=" + redirect_uri;
		response.sendRedirect(url);
		return null;
    }
}
